<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
    String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>添加户型</title>

<base target="_self" />

<link href="<%=path1%>/ht/Styles/css.css" rel="stylesheet" type="text/css" />
<link href="<%=path1%>/ht/Styles/ts_css.css" rel="stylesheet" type="text/css" />
<script src="<%=path1%>/ht/Scripts/My97DatePicker/WdatePicker.js"
	type="text/javascript"></script>
<script src="<%=path1%>/ht/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="<%=path1%>/ht/Scripts/IndexManager.js" type="text/javascript"></script>
<!-- <script src="Scripts/jquery.min.js" type="text/javascript" ></script>
<script src="Scripts/jquery.validate.min.js" type="text/javascript" ></script> -->

<script type="text/javascript">
//添加楼栋信息
    function addAjax(){
	//alert("走了麽");
	$.ajax({
		data:{
			apartment_layout:$("#apartment_layout").val()			
		},
		type:"post",
		datatype:'json',
		url:"<%=path1%>/ht/apar/addApar.do",
		error:function(data){
			//alert(data);
			alert("出错了");
		},
		success:function(data){
			//alert(data);
			//alert("添加成功");
			window.location.href="<%=path1%>/ht/apar/selectAll.do";
		}
	})
}

</script>

<script type="text/javascript">
  function apartment_layouts(){
	  var apartment_layout=document.getElementById("apartment_layout").value;
	  if(apartment_layout=="" || apartment_layout==null){
		  //alert("户型不能为空");
		  //apartment_layout.focus();
		  return false;
	  }
	  return true;
  }
</script>
  <script type="text/javascript">
  function breaks(){
	  window.location.href="<%=path1%>/ht/apar/selectAll.do";
  }
  </script>
<script>
   function danji(){
       if(apartment_layouts()==true){
    	   addAjax();
       }else{
    	   alert("红色星号为必填项！");
       }
   }
</script>   
</head>
<form id="form1" method="post" name="form1">
		<div id="divTwo">
			<table width="100%" border="0" cellpadding="3" cellspacing="3"
				class="table_list1">
				<h2 align="center">添加户型信息</h2>
				<tr>
					<td width="50%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 户型名称:
					</td>
					<td width="50%" class="table_list1_style2"><input type="text"
						id="apartment_layout"  onblur="apartment_layouts()"/></td>

				</tr>

				<tr>
					<td class="table_list1_style1">

						<p></p> <input type="button" id="send" value="添加" tabindex="1"
						class="button" onclick="danji()" /> &nbsp;
					</td>
					<td width="1%" class="table_list1_style2">

						<p></p> <input type="button" class="button" value="关闭"
						tabindex="1" onclick="breaks()" />
					</td>
					<td class="table_list1_style1">&nbsp;</td>
				</tr>
				
			</table>
		</div>
	</form>
</body>
</html>